<template>
  <!-- #ifndef MP-WEIXIN -->
  <up-popup :show="show" mode="center">
    <view class="login_box">
      <view class="login_view">
        <h3 class="login_title">登录</h3>
        <view class="login_close" @click="OffClick">X</view>
        <!-- #ifdef MP-WEIXIN -->
        <wx-quick-login @on-success="headelSuccess" :agree="checked" />
        <!-- #endif -->
        <!-- #ifdef H5 -->
        <app-quick-login @on-success="headelSuccess" :agree="checked" />
        <!-- #endif -->
        <view class="login_other" @click="skipJump"> 其他登录方式 </view>
        <view class="agree">
          <checkbox
            class="check-box"
            value="cb"
            style="transform: scale(0.6)"
            :checked="checked"
            @click="getContent"
          />
          <view>
            我已阅读并同意<text
              style="color: #5590f6"
              @click="getuserprotocol(1)"
              >《用户服务协议》</text
            >和<text style="color: #5590f6" @click="getuserprotocol(2)"
              >《隐私政策》</text
            ></view
          >
        </view>
      </view>
    </view>
  </up-popup>
  <!-- #endif -->
  <!-- #ifdef MP-WEIXIN -->
  <up-overlay :show="show">
    <view class="login_box max">
      <view class="login_view">
        <h3 class="login_title">登录</h3>
        <view class="login_close" @click="OffClick">X</view>
        <!-- #ifdef MP-WEIXIN -->
        <wx-quick-login @on-success="headelSuccess" :agree="checked" />
        <!-- #endif -->
        <!-- #ifdef H5 -->
        <app-quick-login @on-success="headelSuccess" :agree="checked" />
        <!-- #endif -->
        <view class="login_other" @click="skipJump"> 其他登录方式 </view>
        <view class="agree">
          <checkbox
            class="check-box"
            value="cb"
            style="transform: scale(0.6)"
            :checked="checked"
            @click="getContent"
          />
          <view>
            我已阅读并同意<text
              style="color: #5590f6"
              @click="getuserprotocol(1)"
              >《用户服务协议》</text
            >和<text style="color: #5590f6" @click="getuserprotocol(2)"
              >《隐私政策》</text
            ></view
          >
        </view>
      </view>
    </view>
  </up-overlay>
  <!-- #endif -->
</template>

<script setup>
import { customNav } from "@/utils/customNav";
import { ref, defineProps, watch, defineEmits } from "vue";
import appQuickLogin from "@/components/app-quickly-login/index.vue";
import wxQuickLogin from "@/components/wx-quickly-login/index.vue";
const props = defineProps({
  indicate: {
    type: Boolean,
  },
});
const emit = defineEmits(["on-off", "on-make"]);
const show = ref(false);
const checked = ref(false);
watch(
  () => props.indicate,
  (newVal, oldVal) => {
    console.log("newVal", newVal);

    show.value = newVal;
  }
);
function skipJump() {
  customNav("/package_login/pages/login/login");
}

function getuserprotocol(data) {
  uni.navigateTo({
    url: `/package_login/pages/login/protocol?id=${data}`,
  });
}
function getContent() {
  checked.value = !checked.value;
}
function headelSuccess(data) {
  emit("on-make", data);
}
function OffClick() {
  emit("on-off");
}
</script>

<style lang="less" scoped>
@import url(./style/index.less);
</style>